/**
 * @author Administrator
 */
function add_train_line(){
	var train_info_table = document.getElementById("train_info_list");
	var start_city = document.getElementById("start_city");
	var end_city = document.getElementById("end_city");
	var train_num = document.getElementById("train_num_edit");
	var train_date = document.getElementById("train_date_edit");
	var	radio_addr = document.getElementById("by_addr");
	
	if (radio_addr.checked) {
		if (!start_city.value || !end_city.value || !train_date.value)
			return null;
	} else {
		if (!train_num.value || !train_date.value)
			return null;
	}
	
	var new_tr = document.getElementById(start_city.value+end_city.value+train_date.value);
	if (new_tr)
		return null;
		
	new_tr = document.createElement("tr");
	new_tr.setAttribute("id", start_city+end_city);
	
	var cell_start_city = document.createElement("td");
	var cell_end_city = document.createElement("td");
	var cell_date = document.createElement("td");
	var cell_train_num = document.createElement("td");
	var cell_seat_type = document.createElement("td");
	var cell_update_time = document.createElement("td");
	var cell_op = document.createElement("td");
	
	cell_start_city.setAttribute("class", "cell_start_city");
	cell_end_city.setAttribute("class", "cell_end_city");
	cell_date.setAttribute("class", "cell_date");
	cell_train_num.setAttribute("class", "cell_train_num");
	cell_seat_type.setAttribute("class", "cell_seat_type");
	cell_update_time.setAttribute("class", "cell_update_time");
	cell_op.setAttribute("class", "cell_op");
	
	cell_start_city.innerHTML = start_city.value;
	cell_end_city.innerHTML = end_city.value;
	cell_date.innerHTML = train_date.value;
	cell_train_num.innerHTML = train_num.value;
	cell_seat_type.innerHTML = "";
	cell_update_time.innerHTML = "";
	cell_op.innerHTML = "����";
	
	new_tr.appendChild(cell_start_city);
	new_tr.appendChild(cell_end_city);
	new_tr.appendChild(cell_date);
	new_tr.appendChild(cell_train_num);
	new_tr.appendChild(cell_seat_type);
	new_tr.appendChild(cell_update_time);
	new_tr.appendChild(cell_op);
	
	
	train_info_table.appendChild(new_tr);
}

function refresh(){
	
}

function openSettings() {
		window.showModalDialog('pref_dlg.html', "", "DialogWidth:300px;DialogHeight:250px;help:no;status:no;scroll:no");
}

function select_query_way(){
	var	radio_train_num = document.getElementById("by_train_num");
	var start_city = document.getElementById("start_city");
	var end_city = document.getElementById("end_city");
	var train_num_edit = document.getElementById("train_num_edit");
	
	if (radio_train_num.checked) {
		start_city.setAttribute("disabled", true);
		end_city.setAttribute("disabled", true);
		end_city.value = start_city.value = "";
		//start_city.setAttribute("style", "background:gray;");
		//end_city.setAttribute("style", "background:gray;");
		
		train_num_edit.disabled = false;
		//train_num_edit.removeAttribute("style");
	} else {
		start_city.setAttribute("disabled", false);
		end_city.setAttribute("disabled", false);
		//start_city.removeAttribute("style");
		//end_city.removeAttribute("style");
		
		//train_num_edit.setAttribute("style", "background:gray;");
		train_num_edit.disabled = true;
		train_num_edit.value = "";
	}
}
	